#include "genericdatawindow.hpp"


DataWindow::DataWindow(string dataname,MainWindow *main){
    type=DATA;

    principalwindow = main;

    //interface load
    Glib::RefPtr<Gnome::Glade::Xml> Widgetstree = Gnome::Glade::Xml::create("data.glade");

    Widgetstree->get_widget_derived("window", window);

    Widgetstree->get_widget("label", label);

    //signal linkage
    window->signal_delete_event().connect(sigc::mem_fun(*this, &DataWindow::close));

    //Initializations

    label->set_label(dataname);

    id=principalwindow->emptyid;
    principalwindow->emptyid++;

    string title("ID: ");
    std::stringstream ss;
    ss << id;
    title+=ss.str();
    window->set_title(title);
    window->show_all();
}

DataWindow::~DataWindow(){
    window->destroy_();
    delete window;
}

bool DataWindow::close(GdkEventAny *){
    principalwindow->closethisObject(this);
    return true;
}

PositionMapWindow::PositionMapWindow(PositionMap* map,MainWindow *main) : DataWindow("Position Map",main){
    data=map;
    type=POSITIONMAP;
}

PositionMapWindow::~PositionMapWindow(){
    delete data;
}

PositionMap* PositionMapWindow::getData(){
    return data;
}


RCDataWindow::RCDataWindow(RCData* data,MainWindow *main) : DataWindow("RC data",main){
    this->data=data;
    type=RCDATA;
}

RCDataWindow::~RCDataWindow(){
     delete data;
}

RCData* RCDataWindow::getData(){
    return data;
}
